v-if="dataBuffer"
<template>
	<view>
		<view  v-if="dataBuffer">
			<view class="item"
				v-for="(res, index) in siteList" :key="res.id" 
				
			>	<u-icon name="close-circle-fill" :size="40" color="#ff5500" :index="res.id"></u-icon>
				<view class="top"  @click="choiceAddress(index)">
					<view class="name">{{ res.username }}</view>
					<view class="phone">{{ res.userphone }}</view>
					<view class="tag">
						<text class="red" v-if="res.status == 1">默认</text>
					</view>
				</view>
				<view class="bottom" >
					{{res.location+res.useraddress}}
					<u-icon name="edit-pen" :size="40" color="#999999" :index="res.id" ></u-icon>
				</view>
			</view>
		</view>
		<view v-else>
			暂无收货地址信息!
		</view>
		<view class="addSite" @tap="toAddSite">
			<view class="add">
				<u-icon name="plus" color="#ffffff" class="icon" :size="30"></u-icon>新建收货地址
			</view>
		</view>
	</view>
</template>

<script>

export default {
	data() {
		return {
			siteList: [],//初始化地址数据
			dataBuffer:true
		};
	},
	onShow() {
	     // 1.检测是否登录
			let userInfo = this.$tool.islogin()
			if(userInfo != false){ 
				// 2.获取用户的收获地址数据
				this.getUserAddress(userInfo.uid)
			}
	},
	methods: {
		// 跳转到新增地址页面
		toAddSite(){
			uni.navigateTo({
				url:'./addSite'
			})
		},
		//切换会员收货地址
		choiceAddress(index){
			uni.navigateTo({
				url:"../order/order?address="+JSON.stringify(this.siteList[index])
			})
		},
		//获取会员默认地址
		getUserAddress(uid){
			this.$http({
				url:'addresslist',
				data:{uid}
			}).then(res=>{
				console.log(res.list)
				if(res.list==null){
					this.dataBuffer=false
				}else{
					this.dataBuffer=true
					this.siteList=res.list
				}
			}).catch(err=>console.log(err))
		}
	}
};
</script>

<style lang="scss" scoped>
	// 引入样式
	@import  '@/static/css/address.scss';
</style>
